From ef19ae19f876d9cb04fac10141d23c8ae500f9e7 Mon Sep 17 00:00:00 2001
From: Andreas Baierl <ichgeh@imkreisrum.de>
Date: Tue, 26 May 2015 09:18:46 -0400
Subject: [PATCH 1/9] arm:sunxi:disp: Fix division by zero

---
 drivers/video/sunxi/disp/disp_video.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/video/sunxi/disp/disp_video.c b/drivers/video/sunxi/disp/disp_video.c
index aa07364..765f6ec 100644
--- a/drivers/video/sunxi/disp/disp_video.c
+++ b/drivers/video/sunxi/disp/disp_video.c
@@ -71,10 +71,14 @@ static __s32 video_enhancement_start(__u32 sel, __u32 id)
 	/* !!! assume open HDMI before video start */
 	if (gdisp.screen[sel].output_type == DISP_OUTPUT_TYPE_HDMI) {
 		scaler_index = gdisp.screen[sel].layer_manage[id].scaler_index;
-		scaleuprate =
-			gdisp.screen[sel].layer_manage[id].para.scn_win.width *
-			2 /
-			gdisp.screen[sel].layer_manage[id].para.src_win.width;
+
+		if ((gdisp.screen[sel].layer_manage[id].para.scn_win.width ==
+		     gdisp.screen[sel].layer_manage[id].para.src_win.width) ||
+		    (gdisp.screen[sel].layer_manage[id].para.src_win.width < 1280))
+			scaleuprate = 0;
+		else
+			scaleuprate = gdisp.screen[sel].layer_manage[id].para.scn_win.width * 2 /
+			              gdisp.screen[sel].layer_manage[id].para.src_win.width;
 
 		switch (scaleuprate) {
 		case 0:	/* scale down, do noting */
-- 
2.7.0

